function [output,glavr]=pco_camera_getsetting(glavr,settingdata)
out_ptr=glavr.out_ptr;

%% get convertion
conversion=int16(0);
[errorCode,out_ptr,conversion] = calllib('PCO_CAM_SDK', 'PCO_GetConversionFactor', out_ptr,int16(settingdata.conversion));
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.conversion=double(conversion)/100;

%% get cooling
cooling=int16(0);                       
[errorCode,out_ptr,cooling] = calllib('PCO_CAM_SDK', 'PCO_GetCoolingSetpointTemperature', out_ptr,cooling);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.cooling=cooling;

%% get acquiremode
acquiremode=int16(0);
[errorCode,out_ptr,acquiremode] = calllib('PCO_CAM_SDK', 'PCO_GetAcquireMode', out_ptr,acquiremode);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.acquiremode=acquiremode+1;

%% get pixelclock
pixelrate=int64(0);
[errorCode,out_ptr,pixelrate] = calllib('PCO_CAM_SDK', 'PCO_GetPixelRate', out_ptr,pixelrate);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
if pixelrate==10000000
    pixelclock=1;
else
    pixelclock=2;
end
settingdata.pixelclock=pixelclock;

%% get doubleimage
doubleimage=int16(0);
[errorCode,out_ptr,doubleimage] = calllib('PCO_CAM_SDK', 'PCO_GetDoubleImageMode', out_ptr,doubleimage);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.doubleimage=doubleimage+1;

%% get offsetctrl 
offsetctrl=int16(0);
[errorCode,out_ptr,offsetctrl] = calllib('PCO_CAM_SDK', 'PCO_GetOffsetMode', out_ptr,offsetctrl);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.offsetctrl=offsetctrl+1;

%% get bwnoise 
bwnoise=int16(0);
[errorCode,out_ptr,bwnoise] = calllib('PCO_CAM_SDK', 'PCO_GetNoiseFilterMode', out_ptr,bwnoise);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.bwnoise=bwnoise+1;

%% get sensorformat
sensorformat=int16(0);
[errorCode,out_ptr,sensorformat] = calllib('PCO_CAM_SDK', 'PCO_GetSensorFormat', out_ptr,sensorformat);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.sensorformat=sensorformat+1;

%% exposure delay
timebase=[1e-6,1e-3,1];
del_timebase=uint32(2);
del_time=uint32(settingdata.delay);%uint32(0)
exp_timebase=uint32(2);
exp_time=uint32(settingdata.exposure);%uint32(10)
[errorCode,out_ptr,del_time,exp_time,del_timebase,exp_timebase] = calllib('PCO_CAM_SDK', 'PCO_GetDelayExposureTime', out_ptr,del_time,exp_time,del_timebase,exp_timebase);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.delay=double(del_time)*timebase(del_timebase+1);
settingdata.exposure=double(exp_time)*timebase(exp_timebase+1);

%% trigmode
trigmode=int16(0);
[errorCode,out_ptr,trigmode] = calllib('PCO_CAM_SDK', 'PCO_GetTriggerMode', out_ptr,trigmode);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.trigmode=trigmode+1;
%% recordmode
recordmode=int16(0);
[errorCode,out_ptr,recordmode] = calllib('PCO_CAM_SDK', 'PCO_GetRecorderSubmode', out_ptr,recordmode);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.recordmode=recordmode+1;

%% timestamp
timestamp=int16(0);
[errorCode,out_ptr,timestamp] = calllib('PCO_CAM_SDK', 'PCO_GetTimestampMode', out_ptr,timestamp);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.timestamp=timestamp+1;
%% bin_horizon bin_vertical
bin_vertical=int16(0);
bin_horizon=int16(0);
[errorCode,out_ptr,bin_horizon,bin_vertical] = calllib('PCO_CAM_SDK', 'PCO_GetBinning', out_ptr,bin_horizon,bin_vertical);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.bin_vertical=bin_vertical;
settingdata.bin_horizon=bin_horizon;
%% adconverter
adconverter=int16(0);
[errorCode,out_ptr,adconverter] = calllib('PCO_CAM_SDK', 'PCO_GetADCOperation', out_ptr,adconverter);
if(errorCode)
    disp(['PCO_SetConversionFactor failed with error ',num2str(errorCode,'%X')]);
end
settingdata.adconverter=adconverter;

%% get back time DelayTime
dwSec=uint32(0);
dwNanoSec=uint32(0);
[errorCode,out_ptr,dwSec,dwNanoSec] = calllib('PCO_CAM_SDK', 'PCO_GetCOCRuntime', out_ptr,dwSec,dwNanoSec);
if(errorCode)
    disp(['PCO_GetCOCRuntime failed with error ',num2str(errorCode,'%X')]);
end
waittime_s = double(dwNanoSec);
waittime_s = waittime_s / 1000000000;
waittime_s = waittime_s + double(dwSec);
glavr.DelayTime=waittime_s;

output = settingdata;